<template>
  <el-dialog width="70%"  :append-to-body="true"  :title="title" :visible.sync="visible">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <el-form  :inline="true" :model="searchModel" size="small" >
        <el-form-item label="公司名称">
          <el-input v-model="searchModel.name" placeholder="公司名称"></el-input>
        </el-form-item>
        <el-form-item label="联系人">
          <el-input v-model="searchModel.contact" placeholder="联系人"></el-input>
        </el-form-item>
        <el-form-item>
           <span style="float: left;overflow: hidden;" class="">
              <el-button type="primary" @click="searchQuery" icon="el-icon-search">查询</el-button>
              <el-button type="primary" @click="searchReset" icon="el-icon-refresh" style="margin-left: 8px">重置</el-button>

<!--              <el-button @click="handleToggleSearch()" type="text" size="small">-->
<!--                {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!--                <i :class="toggleSearchStatus ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>-->
<!--              </el-button>-->
          </span>
        </el-form-item>
      </el-form>
    </div>

    <!-- table区域-begin -->
    <div class="project">
      <el-table :data="dataSource"  @row-click="rowClick" style="width: 100%" :header-cell-style="{background:'#eef1f6',color:'#606266'}"  v-loading="loading" size="small">
        <el-table-column align="center" label="#"  width="55">
          <template slot-scope="scope">
            <el-radio v-model="singleSelRowKey" :label="scope.row.id">&nbsp;</el-radio>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="公司名称" ></el-table-column>
        <el-table-column prop="contact" label="联系人" ></el-table-column>
        <el-table-column prop="phone" label="联系电话"></el-table-column>
        <el-table-column prop="address" label="公司地址" ></el-table-column>
        <el-table-column prop="receiveLimit" label="领用额度"></el-table-column>
      </el-table>

      <pagination
        :total="ipagination.total"
        :page.sync="ipagination.current"
        :limit.sync="ipagination.pageSize"
        @pagination="loadData"
      ></pagination>
    </div>

    <div slot="footer" class="dialog-footer">
      <el-button @click="handleCancel">取 消</el-button>
      <el-button type="primary" @click="handleSubmit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>

  import Vue from 'vue'
  import { SingleTableMixins } from '@/mixins/SingleTableMixins'

  export default {
    name: "SelectCompanyModal",
    mixins: [ SingleTableMixins ],
    data () {
      return {
        title:"选择公司",
        visible: false,
        loading:false,
        /* 分页参数 */
        ipagination:{
          pageSize:10,
          current:1,
          total: 0,
        },
        model: {},
        url: {
          list: "/company/list",
        },  // 新增资产表单验证
      }
    },
    created () {

    },
    methods: {
      open() {
        this.visible = true;
        this.loadData(1);
      },
      handleSubmit () {
        const that = this;
        that.$emit('ok',that.singleSelRows);
        that.close();
      },
      handleCancel () {
        this.close()
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
    }
  }
</script>

<style scoped>

</style>
